// https://nuxt.com/docs/api/configuration/nuxt-config

import { CONFIG } from './lib/config'
import { languages } from './server/utils/languages'
console.log('languages', languages)
export default defineNuxtConfig({
  compatibilityDate: '2024-11-01',
  devtools: { enabled: false },
  modules: [
    '@una-ui/nuxt',
    '@nuxtjs/i18n',
    'nuxt-zod-i18n',
    '@pinia/nuxt',
    '@nuxt/content',
    '@nuxtjs/seo',
    '@stefanobartoletti/nuxt-social-share'
  ],
  runtimeConfig: {
    // 服务端专用配置（不暴露给客户端）
    jwtSecret: 'default-secret', 
    jwtRefreshSecret: 'default-refresh-secret',
    databaseUrl: 'sqlite://./db.sqlite',
    googleClientId: 'null',
    googleClientSecret: 'null',
    githubClientId: 'null',
    githubClientSecret: 'null',
  },
  socialShare: {
    baseUrl: CONFIG.siteUrl
  },
  site: { indexable: true },
  robots: {
    disallow: ['/secure', '/admin'],
    allow: ['/']
  },
  routeRules: {
    '/secure/**': { robots: false } 
  },
  una: {
    prefix: 'N',
    themeable: true,
    global: true,
  },
  colorMode: {
    preference: 'system',
  },
  i18n: {
    locales: languages,
    strategy: 'no_prefix',
    defaultLocale: 'en-GB',
    lazy: true,
    detectBrowserLanguage: {
      useCookie: true,
      alwaysRedirect: true,
      fallbackLocale: 'en-GB'
    },
    bundle: {
      optimizeTranslationDirective: false,
    }
  }
})